<?php

namespace App\Http\Controllers\H5;

use App\Http\Controllers\Controller;

use App\Lib\JSSDK;
use App\Models\Baoming;
use App\Models\Popularity;
use App\Models\Singer;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Request;


class IndexController extends Controller
{


    public function index()
    {
        return view('h5.home2017');
    }

    public function about()
    {
        return view('h5.about');
    }

    public function getBaoming()
    {
        $params = Input::all();

        if (isset($params['team'])) {
            return view('h5.enter-team');
        }

        $source = Baoming::$source;

        return view('h5.enter-personal', compact('source'));
    }

    public function hot()
    {
        $singer = new Singer();
        $list = $singer->where('hot', 1)->get()->toArray();


        return view('h5.hot', compact('list'));
    }

    public function getDetail($id)
    {
        $singer = new Singer();
        $singer = $singer->find($id)->toArray();

        $jssdk = new JSSDK('wx22112b94af294c89','2f7862a51ad7f2cff7c53027a4128fda');
        $signPackage = $jssdk->GetSignPackage();

        return view('h5.share', compact('singer','signPackage'));
    }

    public function juesai()
    {
        $singer = new Singer();
        $list = $singer->where('final', 1)->get()->toArray();


        return view('h5.hot-12', compact('list'));
    }

    public function finals()
    {
        $singer = new Singer();
        $list = $singer->where('final', 1)->get()->toArray();


        return view('h5.hot-3', compact('list'));
    }


    public function getHotdetail($id)
    {
        $singer = new Singer();
        $singer = $singer->find($id)->toArray();

        $jssdk = new JSSDK('wx22112b94af294c89','2f7862a51ad7f2cff7c53027a4128fda');
        $signPackage = $jssdk->GetSignPackage();

        return view('h5.share-12', compact('singer','signPackage'));
    }


    public function getSuccess()
    {
        return view('h5.success');
    }

    public function clause()
    {
        return view('h5.clause');
    }

}
